<template>
  <a-select
    v-model:value="factory"
    style="width: 120px; text-align: center"
    :disabled="disabled"
    @change="handleChange"
  >
    <a-select-option
      v-for="item in factoryList"
      :value="item.code"
      :key="item.code"
      :disabled="item.disabled"
    >
      {{ item.name }}
    </a-select-option>
  </a-select>
</template>

<script lang="ts">
import { defineComponent, inject } from "vue";
import { FactorySelectSymbol, FactorySelectProp } from "./factory-select-hook";

export default defineComponent({
  name: "FactorySelect",
  setup() {
    const state: FactorySelectProp | undefined = inject(FactorySelectSymbol);
    return {
      ...state,
    };
  },
});
</script>
